import type {AsyncComponentLoader} from "vue";
import {defineAsyncComponent} from "vue";
import {AsyncLoading} from "@/components/Loading/index";

/**
 * * 异步加载组件
 * @param loader
 * @returns
 */
export const loadAsyncComponent = (loader: AsyncComponentLoader<any>) =>
    defineAsyncComponent({
        loader,
        loadingComponent: AsyncLoading,
        delay: 20,
    })
